package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author xiaobo
 * @date 2021/9/4 - 10:25
 */
public class AlipayConfig {

    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000118612292";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC+QJEh3uu0LUdyei774u2AhVRGZ2PWi0F3yTwHzEZIxPND3nLjzZ5gL3CoKT9tgwPFPGfTeS3HX6kqY1Mcu8C2eRP+LuTfXs07oC6QbEQ2uNE1/tY+mheCthTkNjLbYi701ERzkgf0uIzoQx6NJtZYGtsBLj5L8Z/krCbcpctEOY/ZQKyT4pZdklQBtBISq1UZALqy434cFqDlUxF+0r1aTZyyaT/rgtWhDy0vpRqretQw52TZNSnkUgzWiX96wHCz1QPzytfFbwUc+TSAvWFiYtaloTIrh0Tb1u3dSLEtcqbAvBEgq5xzh31eCrfJO8D1Sa60BKrOiP2aYsfXpEjrAgMBAAECggEAB0xOxO/aNtUt0nRhbQQtfCqhKvo4WDiLUF8F0H7Di3MSqd3Upmxy0NnBBpJefoLyGBTTHsedO/KteJTK0WVaZSWL4MpHuVHXqZvhbWTZ0QeR7vJRoaEjmb4GWyLBHK1Ng9LItW46o+aYcShx+ZQt0L9m+0qc1Sj1qz33V6t8eqdxlcxE906crAZApDklUxeap+JpJ9VW6y90bg+R00VJYqtoBqdja59aC7iSNBqcW8RTLwt0oKOWOLqCMNK3dL4Us3Qi0sdVR3vlRuuAXfzibYYBmvIrRNvrzKaCmZDia+ZqSKxUMHRRbLFuFG6O9u2xZf8T39kDL1xMd+mLBfuncQKBgQD2rbRcPh1K1juSKCalyin5CLusUFttsGnEMeSyHdIGGBEcKMj6RoUJuyeSH/uOOTDZhBZKk3nQ8C5WyRuVqG5bSAxmuKF9Ner/VEpm6czpfv1KsnjX5yNd2vA38EHaKgE5fBT7AhixopzDtYHve3KLddtJ9TFYfVL2PubVlyqVJQKBgQDFcQLEDohnKVuTxjn3+Cs8wIfAJ5+csEU9FMfKaxKSMnlTUa3o4GGfmD9kAR6bEku3H9G/Ohn2JY3thBII1TgSad2QGo9hmwEyGUCyJcfl0qcClhu0LhH21Kzym9GvoJVAjlClnp/Cl5n/Uu6sdGoREwkwG2Z2U7UhM1yw7OfwzwKBgEoa1NwBLPuWcD7wIOwdV46guQCDA3RoUt3Fv1Zi7v01ra4v8nB9TuoldzXGteN7+tjdfXTZ6PaDsOgRcl/7QWvasR8KyDi9QeOChvdztUNQCvette/mWBGR/ChR3PaVN9j1FbhyYMi8eSuyE17GTxrmRQJqznAu9gVT0DTKPNihAoGBAKZVJXpbr+gQvHiKt41CgdJldDeaaenLyhjCJ+pMN9H4OaPKnNMiLLwRu92Y39rOGAFHCiGqZfKrAp1E9RiB4AILM7/R0FbvCZvWEF3EXFouE8qnAOHTKgkidCzSvlzR0MsY2bIdJwP9SZwCltWsISsPOV9QxgoLTP2SUpUuj9ubAoGBAPDSFlEJ1AMIoDI5ZqQ+VkjKCsJ53YK6BPr33tt2aaTws9YGAV2tUA3vN8gkUoQ0EgDqpxX9WVHIbquBhdFpHJmbGVNYuIS5FUsL4pSC/jPZueHOv1T4PF+zNF8h+8f/I0HRI2BobAeqGNAstV+BYIO5dfObpLAEFwia99UvHAQq";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvkCRId7rtC1Hcnou++LtgIVURmdj1otBd8k8B8xGSMTzQ95y482eYC9wqCk/bYMDxTxn03ktx1+pKmNTHLvAtnkT/i7k317NO6AukGxENrjRNf7WPpoXgrYU5DYy22Iu9NREc5IH9LiM6EMejSbWWBrbAS4+S/Gf5Kwm3KXLRDmP2UCsk+KWXZJUAbQSEqtVGQC6suN+HBag5VMRftK9Wk2csmk/64LVoQ8tL6Uaq3rUMOdk2TUp5FIM1ol/esBws9UD88rXxW8FHPk0gL1hYmLWpaEyK4dE29bt3UixLXKmwLwRIKucc4d9Xgq3yTvA9UmutASqzoj9mmLH16RI6wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/pay/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/pay/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
